Welcome

DWG Processor Application

The DWG Processor Application adds DWG support to your M-Files installation. This allows DWG format files to be processed on the M-Files server without the need to have AutoCAD or other authoring applications installed on either the client workstations or on the M-Files server.

The application allows users to automatically or *manually perform the following operations from an M-Files client:

  • Synchronise M-Files properties to DWG Attributes
  • Bind External References to create a self contained drawing for distribution
  • Generate PDF renditions of DWG files

As these operations are all carried out on the M-Files server, automated usage is fully compatible with the M-Files Desktop, Web and Mobile client applications.

* Manual access of these functions is implemented via the DWG Tools UI Extensibility Framework application and is therefore limited to the M-Files desktop client only.

Other Help resources:

Help Hub

PentagonDocs Assistant

Pentagon Mail Assistant

Help for specific Applications:

Core Script Library

DWG Processor (you are here)

Extranet Uploader

Notifications Processor

PDF Processor

Transmittals

Copyright © Pentagon Solutions Ltd. All Rights Reserved.


Third Party Components

The DWG Processor Application embeds licensed technology from Autodesk® and the Open Design Alliance to provide compatibility with the AutoCAD® DWG file format. DWG files are supported back to AutoCAD Release 14 format, providing compatibility with drawings over 20 years old.

Real DWG

Drawing write operations are processed using Real DWG from Autodesk to ensure modified DWG files maintain their trusted status.

TrustedDWG™ technology lets you know of potential incompatibility when a file was not last saved by an Autodesk software, and identifies files which might not be supported by Autodesk software.

Open Design Alliance

The Open Design Alliance Drawings SDK libraries are used for the rendering of Drawings as PDF.

Architecture SDK modules are included to provide support for AutoCAD Architecture.


Known Issues and Limitations

AutoCAD Verticals

The following versions of AutoCAD are supported:

  • AutoCAD
  • AutoCAD Architecture

The following verticals are not supported (but may still work depending on usage):

  • AutoCAD Civil
  • AutoCAD Electrical
  • AutoCAD Map 3D
  • AutoCAD Mech
  • AutoCAD MEP
  • AutoCAD Structural Detailing
  • AutoCAD Utility Design
  • AutoCAD P&ID
  • AutoCAD Plant 3D

PDF Output

The generated PDF is a single page document of the specified Layout of the processed drawing file. The paper size, orientation and scaling of the drawing on the page is determined by the Page Setup of the Layout/Model in the drawing. If the 'Zoom to Extents Mode' option is set in the PDF Rendition Settings , the drawing will be zoomed to the specified paper size. If no Page Setup is configured for the Layout then an error is generated and the operation will fail.

External Reference Support (XREF)

The DWG Processor only supports the use of XREFs where both the parent and child drawings are in the same Vault. Child reference paths must be relative to the parent file to ensure the DWG Processor can resolve the files correctly during processing. The DWG Processor supports the use of (L) Latest version paths and also version (S) Specific paths. Where Latest reference paths are used, the DWG Processor will attempt to resolve references that have changed between SDF and MFD or vice versa.

Where child references are not in the same vault as the parent drawing, but are on a network drive, these will be resolved provided they were attached using a full path and the M-Files server has access to the reference location.

Binding References

The DWG Processor only supports the Binding of DWG reference files. This is consistent with limitations of AutoCAD, where Image and PDF attachment binding is not supported.

Support Files

For accurate rendering of PDF files, the DWG Processor needs access to AutoCAD Fonts, Shape files, Linetype definitions and Plot configuration files. For copyright reasons, these files are not distributed as part of the DWG Processor install. These files must be sourced by other means.

NOTE: It is recommended that dependent Font files, Shape files, Linetype definitions and Plot configuration files be copied from an AutoCAD workstation to the M-Files server. Please see 'PDF Rendition Settings' for more information.

Language Support

Currently the PentagonDocs Assistant Administration Utility' and 'DWG Tools' UI Extensibility Framework application are provided as English language versions only. For other language versions, please contact Pentagon .


Install Sequence

To install the DWG Processor Application, is recommended that tasks are carried out in the following order:

  • Check and install Prerequisites
  • Configure DCOM Settings
  • Run the DWG Processor Application installer
  • Add the DWG Processor License to one or more Vaults
  • Configure the DWG Processor settings for each Vault

NOTE: Failure to follow the above sequence may result in problems and additional troubleshooting. Please see 'Errors' for more information.

Also See

Prerequisites
DCOM Settings
Server Installation
Licensing


Prerequisites

Before installing the DWG Processor Application on your M-Files Server, please ensure the prerequisites listed below have been met.

  • M-Files Server 2015.3 (11.3.4330.196) or above
  • Microsoft .NET Framework 4.7 or above
  • Visual C++ Redistributable for Visual Studio 2015 (x64)
  • DWG Processor Application License File


DCOM Settings

In order to function correctly, the DWG Processor Application requires a permissions change to the DCOM security on the M-Files server.

To do this, go to the 'Component Services' window. Navigate into 'Component Services\Computers' then right-click on 'My Computer' and select 'Properties'.

In the 'My Computer Properties' dialog box, select the 'COM Security' tab then click 'Edit Default' in the 'Access Permissions' section as shown below.

In the 'Access Permissions' dialog box, click 'Add' to add in the 'LOCAL SERVICE' account as shown below.

NOTE: 'LOCAL SERVICE' is a built-in Windows account that will be used by the DWG Processor Application.

Click 'OK', to close the 'Access Permissions' then again to close the 'My Computer Properties' dialogue box. Finally, close the 'Component Services' window.

The M-Files Server service (mfserver.exe) will need to be restarted for these changes to take effect. To avoid having to manually restart the M-Files Server service, it is recommended DCOM changes take place before running the DWG Processor Application installer. Please see ‘Install Sequence’ for recommended installation order.


Server Installation

To install the DWG Processor Application, run the PentagonDocs_DWGProcessor.msi on the M-Files Server.

As the installer completes, the PentagonDocs Assistant Application Installer' is launched at which time you can select the Vault(s) that you wish to add the DWG Processor'.

NOTE: The installation will take the targeted vaults off-line, while the application is installed. This happens when the installer has finished. This stage can be cancelled and the application installed manually from C:\Program Files\Excitech DOCS\Server\DWG Processor\ExDOCS_DWGProcessor_Server.mfappx.

NOTE: By default the Excitech DOCS Administration Utility is not installed. You can choose to install the Administration Utility on the M-Files server and/or a client PC.

Also See

Prerequisites
DCOM Settings


Client Installation

The PentagonDocs Assitant Administration Utility and/or the DWG Processor Documentation can be installed on a client PC.

To install these components, run the PentagonDocs_DWGProcessor.msi on a client PC.

Also See

Administration


Licensing

Before you can use the DWG Processor Application, you need to install a valid license. A license file can be obtained from Pentagon and is linked to the M-Files installation via the M-Files License Serial Number (xxx-xxxxxxxx).

NOTE: Email support@pentagonsolutions.com to request your license file.

After installation, the Application has a status of 'No license is installed'. Each Vault with the DWG Processor Application will need to have a license added. The same license file can be used across multiple Vaults on the same M-Files server.

To add a license to a Vault, open the M-Files Admin tool on the server. Right-click on the Vault you wish to install the license. From the context menu, select 'Applications'


Administration

The DWG Processor Application includes the 'PentagonDocs Assitant Administration Utility'. This can be deployed to the M-Files server and/or a client PC. The application is launched using the shortcut from the 'PentagonDocs Assistant' program group accessible via the Start menu.

NOTE: Users of the Administration Utility must have at least the 'Change metadata structure' Administrative privilege for the selected vault. If the 'Change metadata structure' privilege is not granted an 'Access Denied' error is displayed when attempting to save configuration changes.

On first launch of the Administration Utility you are prompted to select which Vault you'd like to configure. Each Vault has its own DWG Processor configuration settings.

NOTE: If the selected Vault does not have the DWG Processor installed or any other PentagonDocs Assistant configurable applications, you will be prompted to select another Vault.

Once set, the selected Vault is retained between sessions. To change the selected Vault, select 'Open Vault' from the 'Vault' menu.

The current Vault is displayed on the Status bar.

Configuration Tree

Under the DWG Processor section, the configuration tree has 2 nodes:

Property Mappings | Allows M-Files properties to be mapped to DWG Attributes
PDF Rendition Settings | Determines the appearance, quality and properties of the generated PDF files

These configurable items are covered in more detail in other topics of this help file.

Also See

Property Mappings
PDF Rendition Settings - General
PDF Rendition Settings - Advanced
PDF Rendition Settings - Property Mapping
PDF Rendition Settings - Support Paths


Property Mappings

The DWG Property Synchronisation uses DWG Blocks and Attributes to change textual content in the drawing. In order for this to work, it must first be configured for each Vault. The configuration settings are edited using the 'PentagonDocs Assistant Administration Utility' and the 'Property Mappings' node under 'DWG Processor' in the configuration tree.

Upon selection of the node, you are presented with the configuration options as shown below. The settings can be edited and applied using the buttons in the bottom right corner.

To define which DWG blocks are supported, enter their names in the 'Title Block Names' property.

TIP: Multiple block names can be added using a semi-colon (;) as a separator.

A mapping can be created between an M-Files property and an DWG attribute by clicking the 'Add Mapping' button. This displays the property tree as shown below. Mappings can be made using both direct and indirect properties defined within the selected Vault.

NOTE: Direct properties are those directly associated with the Class the drawing belongs to, these are displayed as root nodes in the property tree. Indirect properties are from linked objects and sub-objects, these are displayed as child nodes in the property tree.

Fill out the 'Attribute' name, and click 'Add' to create the new mapping. Only one mapping per Attribute tag can be created.

TIP: Mappings can be edited or deleted using the 'Edit Mapping' and 'Delete Mapping' buttons.

When all the Block Names and Property Mappings have been entered, click 'OK' or 'Apply' to save the changes.

Also See

Administration


General

General - PDF Rendition Settings

The General PDF Rendition Settings determine how the PDF is generated. These settings have an impact on the PDF format, file size, quality and functionality.

Settings Overview

The sections below give a brief overview of each of the General configuration options.

PDF File Settings

PDF Version

Determines which version of the PDF format is used for export. Versions 1.0 to 1.7 are supported.

Enable Layer Support

Determines whether layer support is enabled. When this option is selected, layers will be added to the generated PDF file.

NOTE: PDF Version 1.5 or higher is required for layer support.

Include Off Layers

When this option is selected, all layers are exported, and the PDF file will contain the same quantity of layers as the original drawing (hidden layers are also exported).

When not selected, only visible layers are exported, and the resulting PDF file doesn't contain hidden layers.

Linearise PDF

A PDF file can be partly processed meaning any portion of the file (e.g. page, link or picture) can be accessed without downloading and reading other elements of the document.

This technology for PDF files is similar to streaming audio or video and is called linearisation. It provides fast incremental access to PDF data. Linearisation has the following advantages:

  • Fast downloading and rendering of a PDF document even for slow connections and big files (because of skipping unnecessary parts when reading data).
  • Quick navigation through the document.
  • Quick application of embedded fonts.
  • Reaction to user actions (for example, clicking a link) without waiting for the entire page to be processed.

To obtain these advantages, select this option.

Enable Compression

The Enable Compression setting determines whether data compression is used during PDF export. If selected, the internal PDF compression algorithm is used. Data compression reduces the size of the output PDF file.

ASCII-HEX Encoded

When selected, the drawing data is written to the PDF file stream in hexadecimal format. This makes the output PDF file compatible with hex-editors.

Export Hyperlinks

Enable exporting hyperlinks to the output PDF file.

Enable Measuring Scale

Determines whether the measuring scale is implemented for the entities in the output PDF file.

PDF Background Colour

Sets the Background colour of the output PDF file.

Colour Policy
  • No Policy – No colour policy is used. A drawing is exported with its native colour palette (as is).

  • Mono – Drawing is exported to a monochrome PDF file.

  • Grayscale – Drawing is exported to a grayscale PDF file. Native colours are converted into grayscale.

Vectorisation and Rendering

Zoom to Extents Mode | Determines whether the exported drawing is in the Zoom to Extents mode. If selected, the layout geometry will be zoomed to the paper size, otherwise layout settings will be applied.
Enable Simple Geometry Optimisation | Determines whether simple geometry optimisation is used when a drawing is exported to a PDF file. Simple geometry optimisation uses a more effective mechanism of drawing document elements (drawing one polyline instead of several separated segments, Bezier curve control points, and so on). E.g. if optimisation is not used, a rectangle is drawn with four commands: one for each line. When optimisation is used, a rectangle is drawn with a single command, thus reducing the overall size of the output file.
Use Hidden Line Removal Algorithm | Determines whether software vector hidden-line removal (HLR) is used to delete hidden lines during the export process for corresponding viewports.
Enable Transparency | Determines whether Layer Transparency is supported when generating the output PDF file.
Merge Crossing Line Colours | Determines whether the colours of crossing lines are merged.

When you have configured the General PDF settings, click 'OK' or 'Apply' to save the changes.

Also See

Administration
PDF Rendition Settings - Advanced


Advanced

Advanced - PDF Rendition Settings

The Advanced PDF Rendition Settings provide greater control on how Text, Hatches and Images are rendered in the generated PDF.

NOTE: These settings have an impact on the PDF file size, quality and functionality.

Settings Overview

The sections below give a brief overview of each of the Advanced configuration options.

Font and Text Settings

Embedded True Type Fonts

When selected, embedded fonts are used for text display. Using embedded fonts results in a larger PDF file size, but guarantees that the text can be correctly displayed in the output PDF file.
When not selected, the font must be installed on the viewers system for the text to display correctly in the output PDF file.

Embedded True Type Font Optimisation

The Embedded TTF Optimization option reduces the size of the output PDF file by removing unused parts of the fonts (for example, characters that are never used in the text). However, embedded font optimization restricts editing abilities of the resulting PDF file.

True Type Fonts as Geometry

Text from the original drawing can be exported to PDF either with geometry (when symbols are drawn as collections of primitives) or with internal facilities of the PDF format.

When selected True Type Fonts are converted to geometry.

SHX Fonts as Geometry

Text from the original drawing can be exported to PDF either with geometry (when symbols are drawn as collections of primitives) or with internal facilities of the PDF format.

When selected SHX Fonts are converted to geometry.

Searchable Text

Determines whether the text from the original drawing can be searched in the output PDF file. The option is only valid for SHX or TTF text exported as geometry.

The option can be set to one of the following values:

  • No Search - No searchable text is in the output PDF file.

  • SHX Fonts will be searchable - Text displayed with SHX fonts will be searchable if 'SHX Fonts as Geometry' option is checked.

  • TTF Fonts will be searchable - Text displayed with TTF fonts will be searchable if 'True Type Fonts as Geometry' option is checked.

  • SHX & TTF Fonts will be searchable - Text displayed with both SHX and TTF fonts will be searchable if the appropriate text is exported as geometry.

Hatch Settings

Hatch Export Resolution (DPI)

Resolution for images created during hatch export (in dots per inch, DPI). This setting only applies to Hatches exported as Bitmaps. Larger DPI settings results in better image quality and larger PDF file size.

Export Solid Hatches using
  • Bitmap - The result of exporting a hatch as a bitmap looks smoother than as a vectorizer and often has a smaller output file size. The output file size strongly depends on the DPI (Dots Per Inch) resolution specified for the export process. Increasing DPI provides better quality but a larger output file.

  • Drawing - Divides the hatch into many triangles; each can contain its own color. This leads to a larger output file size and decreases the quality of the hatch.

  • PDF Paths - Results in a smaller .pdf file size than other methods and avoids distortion of graphical elements. This algorithm exports only the outer loop of the hatch and then fills this loop with the appropriate color.

Export Gradient Hatches using

See Export Solid Hatches

Export Other Hatches using

See Export Solid Hatches

Image Settings

Image Cropping | Determines how clipped images are exported. An image can be clipped by a clipping boundary (for example, by a boundary of a page in a .pdf file or by a viewport boundary). If the option is checked, then only the visible part of the image is exported. Otherwise the full image is exported which will result in a larger PDF file.
DCT Compression | Determines whether the DCT compression (Discrete Cosine Transform) algorithm is used for exporting images. If the option is checked, then DCT compression is used to significantly reduce the size of the output PDF file.
DCT Compression Quality | Determines the quality of the DCT image compression. This value is applied only if the DCT Compression option is checked. The range is between 0 and 100, with lower values resulting in greater compression and smaller PDF file size. Higher values improve image quality resulting in larger PDF file size.
Colour Resolution (DPI) | Resolution for exported color and grayscale images (in dots per inch, DPI). Larger DPI settings results in better image quality and larger PDF file size.
Monochrome Resolution (DPI) | Resolution for exported monochrome images (in dots per inch, DPI). Larger DPI settings results in better image quality and larger PDF file size.

When you have configured the Advanced PDF settings, click 'OK' or 'Apply' to save the changes.

Also See

Administration
PDF Rendition Settings - General


Property Mapping

Property Mapping - PDF Rendition Settings

The DWG Processor Application allows the document properties of the generated PDF to be populated from M-Files. M-Files properties can be mapped to the PDF properties, resulting in object metadata being written to the generated PDF.

The mappings are configured using the 'Property Mapping' tab under 'PDF Rendition Settings'.

NOTE: Direct properties are those directly associated with the Class the drawing belongs to, these are displayed as root nodes in the property tree. Indirect properties are from linked objects and sub-objects, these are displayed as child nodes in the property tree.

To remove a mapping, select the PDF property from the list and click the 'Remove Mapping' button.

Also See

Administration


Support Paths

Support Paths - PDF Rendition Settings

For accurate rendering of PDF files, DWG Processor Application needs access to AutoCAD Fonts, Shape files, Linetype definitions and Plot configuration files - on your M-Files server.

The Support Paths tab allows configuration of the folder locations to search for these files.

Additional support paths can be added using the 'Add Path' button. The selected path can removed by clicking the 'Remove Path' button.

Support paths are searched in the same order they appear in the list, with the first matching file being supplied to the renderer.

Locations for these Support paths may be found within AutoCAD, under the File menu > Options > Files:

They may have been be customised by your company, but some typical locations are as follows:

Example Path | AutoCAD File path
C:\Windows\Fonts |
C:\Program Files\Autodesk\AutoCAD 2021\fonts | Support File Search Path, or Working Support File Search Path
C:\Users\<username>\AppData\Roaming\Autodesk\AutoCAD 2021\R24.0\enu\Plotters\Plot Styles | Printer Support File Path\Plot Style Table Search Path
C:\Program Files\Autodesk\AutoCAD 2021\Support\ | Support File Search Path, or Working Support File Search Path
C:\Program Files\Autodesk\AutoCAD 2021\Support\Color | Color Book Locations
C:\Program Files\Autodesk\AutoCAD 2021\Support\en-us | Support File Search Path, or Working Support File Search Path
C:\Program Files\Autodesk\AutoCAD 2021\UserDataCache\en-us\Support |

When all the Support Paths have been entered, click 'OK' or 'Apply' to save the changes.

NOTE: It is recommended that dependant Font files, Shape files, Linetype definitions and Plot configuration files be copied from an AutoCAD workstation to the M-Files server. e.g. Create an Autodesk folder on the M-Files server, then copy the Fonts, Support and Plotters folders from an AutoCAD workstation into it. Add these folders to the list of Support Paths as shown above.

Also See

Administration


DWG Tools

DWG Processor Client is a UI Extensibility Framework application that allows functions provided by the DWG Processor to be invoked manually from the M-Files desktop client. This application is installed as part of the DWG Processor setup, and deployed as a child application of the Server application.

To make the application available, users will need to logout of M-Files and then log back in. They will then need to click 'Allow' to enable application to run on their computer.

Once installed, the menu items will be displayed on the left short cut menu when a DWG file is selected:

NOTE: The Object must be checked in for the functions to be visible.

Sync Properties to File | Synchronises M-Files properties to DWG Attributes. NOTE: Assumes there is only one DWG file in MFD (Multi File Document) objects.
Bind References | Bind External References to create a self contained drawing for distribution NOTE: Assumes there is only one DWG file in MFD (Multi File Document) objects.
Create PDF Rendition | Generates a PDF rendition of the selected drawing. NOTE: Generation of a PDF Rendition will convert a SFD (Single File Document) to a MFD (Multi File Document). Please see ’Known Issues and Limitations' for more information. Assumes there is only one DWG file in MFD objects.

All functions will generate a new version of the selected object.

NOTE: The DWG Tools UI Extensibility Framework application is currently only provided as an English language version. Please see ’Known Issues and Limitations' for more information.


Set DWG File Version in Metadata

Usage ›› Script Examples ››

Set DWG File Version in Metadata

In this example we will use the DWG Processor GetDWGInfo method to retrieve information from a DWG file, then write the DWG file version to the Keywords property. The code below could be added to any number of event handlers, but for this example we will attach the code to the BeforeCheckInChanges event.

NOTE: The 'BeforeCheckInChanges' event is not executed on 'Check in', not immediately.

Example

  • Open the M-Files Admin, then expand 'Connections to M-Files Servers\Local Computer\Document Vaults'
  • Right-click on the Vault you want to add an Event Handler to (e.g. 'DWG vault')
  • From the context menu select 'Event Handlers'
  • In the 'Event Handlers' dialog box, select 'Add Event Handler'
  • Select the 'BeforeCheckInChanges' event and enter a name for the new handler
  • Click 'OK'
  • Select the newly created event handler and click 'Edit Code'
  • The VBScript used in this example is:

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'ignore errors
On Error Resume Next

'try to get drawing information
Dim dwgInfo : Set dwgInfo = dwgProcessor.GetDWGInfo(Vault, ObjVer, ActivityID)

'reinstate errors
On Error Goto 0

'set default keywords value

keywordsValue = "No DWG File Found"

'on failure dwgInfo will be empty
If Not IsEmpty(dwgInfo) Then

dwgProcessor.WriteLog ActivityID, "DWG File Format Code: " + dwgInfo.DWGFileFormat

Select Case dwgInfo.DWGFileFormat

Case "AC1032"

keywordsValue = "2018 DWG File"

Case "AC1027"

keywordsValue = "2013 DWG File"

Case "AC1024"

keywordsValue = "2010 DWG File"

Case Else

keywordsValue = "Pre-2010 DWG File"

End Select
End If

'set Keywords Property (26)

dwgProcessor.WriteLog ActivityID, "Set Keywords Property: " + keywordsValue

Set propVal = Vault.ObjectPropertyOperations.GetProperty(ObjVer, 26)

propVal.Value.SetValue MFDatatypeText, keywordsValue

Vault.ObjectPropertyOperations.SetProperty ObjVer, propVal

  • When a DWG document is edited / checked in (not immediately), the Keywords property is updated:

The resulting log file would contain the following information:

30/04/2020 16:00:33:4012 - Get Drawing Information

30/04/2020 16:00:33:4327 - DWG File Count: 1

30/04/2020 16:00:33:4327 - Creating RealDWG COM Object. (dllhost.exe)

30/04/2020 16:00:33:5884 - Call GetDrawingInformation COM method.

30/04/2020 16:00:34:4485 - Processing Object: ID 2 Version 6

30/04/2020 16:00:34:4794 - FileVer: ID 2 Version 1

30/04/2020 16:00:34:4794 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\c3fcdc62-3b70-4f17-9d2d-851ff1789aa6\Ground Floor Layout.dwg

30/04/2020 16:00:34:5104 - Open DWG file

30/04/2020 16:00:34:9642 - Create DrawingInfo object

30/04/2020 16:00:34:9642 - Populate file format

30/04/2020 16:00:34:9791 - Populate current layout: A1

30/04/2020 16:00:34:9791 - Populate Layout array

30/04/2020 16:00:34:9950 - Populate DWG References

30/04/2020 16:00:34:9950 - Populate Image References

30/04/2020 16:00:34:9950 - Populate PDF References

30/04/2020 16:00:35:1666 - Delete temp folder from server: C:\ProgramData\Excitech Docs\DWG Processor\Temp\c3fcdc62-3b70-4f17-9d2d-851ff1789aa6

30/04/2020 16:00:35:1666 - Deserialize drawing information from JSON.

30/04/2020 16:00:35:1825 - Releasing COM object.

30/04/2020 16:00:35:2604 - DWG File Format Code: AC1027

30/04/2020 16:00:35:2604 - Set Keywords Property: 2013 DWG File


Update DWG Titleblock on SetProperties

Usage ›› Script Examples ››

Update DWG TitleBlock on SetProperties

In this example we will use the DWG Processor SyncPropertiesFromMFiles method to update attributes in a DWG titleblock. For this example we will attach the code to the AfterSetProperties event. This will update the DWG titleblock whenever the object metadata is edited.

NOTE: This example assumes you have configured the DWG Processor Property Mappings for the current vault. The DWG must also have the appropriate titleblock and attributes defined.

Example

  • Open the M-Files Admin, then expand 'Connections to M-Files Servers\Local Computer\Document Vaults'
  • Right-click on the vault you want to add an Event Handler to
  • From the context menu select 'Event Handlers'
  • In the 'Event Handlers' dialog box, select 'Add Event Handler'
  • Select the 'AfterSetProperties' event and enter a name for the new handler
  • Click 'OK'
  • Select the newly created event handler and click 'Edit Code'
  • In the 'Edit VBScript Code' window, add the following code:

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'store Object details in TransactionCache, to prevent recursive loop

If IsNull(TransactionCache(ObjVer.ToJSON)) Then

TransactionCache(ObjVer.ToJSON) = "Synced"

'sync properties from M-Files

dwgProcessor.SyncPropertiesFromMFiles Vault, ObjVer, ActivityID

'set modifying user

dwgProcessor.SetModifiedBy Vault, ObjVer, CurrentUserID

End If

NOTE: Use the SetModifiedBy method to ensure the modified by user is not set to (M-Files Server).

NOTE: SetModifiedBy will cause the AfterSetProperies event to be triggered again. Use the TransactionCache to prevent a recursive loop.

The resulting log file would contain the following information:

01/01/2019 09:00:00:2672 - Sync Properties from M-Files

01/01/2019 09:00:00:2752 - DWG File Count: 1

01/01/2019 09:00:00:2762 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:5532 - Call SyncPropertiesFromMFiles COM method.

01/01/2019 09:00:00:6372 - Processing Object: ID 15 Version 3

01/01/2019 09:00:00:6502 - FileVer: ID 16 Version 2

01/01/2019 09:00:00:6502 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\adnw1dqz.dwg

01/01/2019 09:00:00:6772 - Open DWG file

01/01/2019 09:00:00:7472 - Update attribute values of matching Titleblocks

01/01/2019 09:00:00:9292 - Save DWG file

01/01/2019 09:00:01:0192 - Upload updated DWG file

01/01/2019 09:00:01:0462 - Delete temp files from server

01/01/2019 09:00:01:0472 - Releasing COM object.


Workflow Layout Precondition

Usage ›› Script Examples ››

Workflow Layout Precondition

In this example, we will use the DWG Processor GetDWGInfo method to retrieve the current layout, then use a workflow Precondition event to prevent a state change based on the current layout.

Example

  • Open the M-Files Admin, then expand 'Connections to M-Files Servers\Local Computer\Document Vaults'
  • Expand out the desired vault and select the 'Workflows' node
  • Configure a simple workflow as shown
  • Double-click the state you wish to restrict (e.g. Released)
  • In the 'State Properties' dialog, select the 'Conditions' tab
  • Check the 'Advanced conditions (VBScript)' option in the Preconditions section, then click the 'Edit Code' button
  • In the 'Edit VBScript Code' window, add the following code:

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'write to log

dwgProcessor.WriteLog ActivityID, "Example Workflow - Release Precondition"

'ignore errors
On Error Resume Next

'try to get drawing information
Dim dwgInfo : Set dwgInfo = dwgProcessor.GetDWGInfo(Vault, ObjVer, ActivityID)

'reinstate errors
On Error Goto 0

'on failure dwgInfo will be empty
If Not IsEmpty(dwgInfo) Then

dwgProcessor.WriteLog ActivityID, "Current Layout: " + dwgInfo.CurrentLayout

'raise error if Model layout is current

If dwgInfo.CurrentLayout = "Model" Then

dwgProcessor.WriteLog ActivityID, "The drawing must not have Model selected."

Err.Raise MFScriptCancel, "The drawing must not have Model selected."

End If
End If

NOTE: Remember to save the changes to the workflow definition.

When trying to move a DWG file to the Released workflow state, the transition is prevented if the DWG has the Model layout selected. The M-Files client also displays a dialog box, as shown below:

The resulting log file would contain the following information:

01/01/2019 09:00:00:4144 - Example Workflow - Release Precondition

01/01/2019 09:00:00:4174 - Get Drawing Information

01/01/2019 09:00:00:4264 - DWG File Count: 1

01/01/2019 09:00:00:4274 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:6844 - Call GetDrawingInformation COM method.

01/01/2019 09:00:00:7324 - FileVer: ID 16 Version 5

01/01/2019 09:00:00:7374 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\bbqnxckf.dwg

01/01/2019 09:00:00:7614 - Open DWG file

01/01/2019 09:00:00:8334 - Create DrawingInfo object

01/01/2019 09:00:00:8344 - Populate file format

01/01/2019 09:00:00:8354 - Populate current layout: A1

01/01/2019 09:00:00:8364 - Populate Layout array

01/01/2019 09:00:00:8514 - Populate DWG References

01/01/2019 09:00:00:8574 - Populate Image References

01/01/2019 09:00:00:8594 - Populate PDF References

01/01/2019 09:00:00:8674 - Delete temp files from server

01/01/2019 09:00:01:0395 - Deserialize drawing information from JSON.

01/01/2019 09:00:01:0395 - Releasing COM object.

01/01/2019 09:00:01:0415 - Current Layout: Model

01/01/2019 09:00:01:0425 - The drawing must not have Model selected.


Workflow Create PDF Rendition

Usage ›› Script Examples ››

Workflow Create PDF Rendition

In this example we will use the DWG Processor CreatePDFRendition method to generate a PDF on a workflow state change. To do this we will add code to the workflow State Actions .

Example

  • Open the M-Files Admin, then expand 'Connections to M-Files Servers\Local Computer\Document Vaults'
  • Expand out the desired vault and select the 'Workflows' node
  • Configure a simple workflow as shown
  • Double-click the state on which you want to generate the PDF (e.g. Released)
  • In the 'State Properties' dialog, select the 'Actions' tab
  • Check the 'Run Script' option, then click the 'Edit Code' button
  • In the 'Edit VBScript Code' window, add the following code:

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'create PDF Rendition

dwgProcessor.CreatePDFRendition Vault, ObjVer, ActivityID

'set modifying user

dwgProcessor.SetModifiedBy Vault, ObjVer, CurrentUserID

NOTE: Use the SetModifiedBy method to ensure the modified by user is not set to (M-Files Server).

NOTE: Remember to save the changes to the workflow definition.

When moving a DWG file to the Released workflow state, a PDF file is added or updated. If the object was a Single File Document (SFD), it is automatically converted to a Multi File Document (MFD).

The resulting log file would contain the following information:

01/01/2019 09:00:00:3701 - Create PDF Rendition

01/01/2019 09:00:00:3761 - DWG File Count: 1

01/01/2019 09:00:00:3771 - Creating ODA COM Object. (dllhost.exe)

01/01/2019 09:00:00:4371 - Call CreatePDFRendition COM method.

01/01/2019 09:00:01:1101 - Processing Object: ID 1 Version 14

01/01/2019 09:00:01:1411 - FileVer: ID 1 Version 5

01/01/2019 09:00:01:1421 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\31dheqpl.dwg

01/01/2019 09:00:01:1871 - Open DWG file

01/01/2019 09:00:01:5512 - Repath References

01/01/2019 09:00:01:8082 - Plot Settings

----------------------------------------------------------------------------------------------------------------------------------

Plot Layout: A1

Plot Type: Layout

Plot Centered: False

Paper Rotation: _90degrees

Paper Origin: 0.00, 0.00

Paper Size: 594.06, 841.04

Paper Units: Millimeters

Paper Margins: (Top): 3.17 (Left): 3.17 (Right): 3.17 (Bottom): 3.17

----------------------------------------------------------------------------------------------------------------------------------

01/01/2019 09:00:01:8152 - Exporting PDF

01/01/2019 09:00:01:9464 - Delete temp files from server

01/01/2019 09:00:02:0032 - Convert Object to MFD.

01/01/2019 09:00:02:0182 - Upload generated PDF file

01/01/2019 09:00:02:0532 - Delete temp PDF file from server

01/01/2019 09:00:02:0542 - Releasing COM object.


BindReferences(Vault, DrawingObjVer, LogIdentifier)

BindReferences Method

Description

Binds any Xrefs in the drawing to make them a permanent part of the drawing and no longer externally referenced files. Binding Xrefs to a drawing is also an easy way to send a drawing to reviewers. Rather than sending a master drawing plus each of the drawings it references, you can use the BindReferenecs method to merge the Xrefs into the master drawing. The DWG file is saved back as the same DWG file version as the original file. For Multi File Document (MFD) objects containing more than one DWG file, only the first file in the collection is processed.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG files exists in the specified object, then an error is raised.

NOTE: You cannot bind Xrefs that contain proxy objects. You cannot bind Image or PDF references. Please see ’Known Issues and Limitations' for details.

Syntax

Sub BindReferences(Vault As Vault, DrawingObjVer As ObjVer, LogIdentifier As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'bind References

dwgProcessor.BindReferences Vault, ObjVer, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:0390 - Bind References

01/01/2019 09:00:00:0480 - DWG File Count: 1

01/01/2019 09:00:00:0490 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:3300 - Call BindReferences COM method.

01/01/2019 09:00:00:3670 - Processing Object: ID 1 Version 10

01/01/2019 09:00:00:3850 - FileVer: ID 1 Version 4

01/01/2019 09:00:00:3850 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\kcsolwsg.dwg

01/01/2019 09:00:00:4110 - Open DWG file

01/01/2019 09:00:00:4770 - Repath and Bind References

01/01/2019 09:00:00:6920 - Upload updated DWG file

01/01/2019 09:00:00:7240 - Delete temp files from server

01/01/2019 09:00:00:7250 - Releasing COM object.


BindReferences(Vault, DrawingObjVer, DrawingName, LogIdentifier)

BindReferences Method

Description

Binds any Xrefs in the named drawing to make them a permanent part of the drawing and no longer externally referenced files. Binding Xrefs to a drawing is also an easy way to send a drawing to reviewers. Rather than sending a master drawing plus each of the drawings it references, you can use the BindReferenecs method to merge the Xrefs into the master drawing. The DWG file is saved back as the same DWG file version as the original file.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is 'Nothing'. Please see Log Files for more information.

The specified object must be in a Checked Out state.

If no DWG file with the specified Drawing Name exists, then an error is raised.

NOTE: You cannot bind Xrefs that contain proxy objects. You cannot bind Image or PDF references. Please see ’Known Issues and Limitations' for details.

Syntax

Sub BindReferences(Vault As Vault, DrawingObjVer As ObjVer, DrawingName As String, LogIdentifier As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
DrawingName | String | The name of the DWG file to process (excluding the file extension). Use with Multi File Document (MFD) objects containing more than one DWG file.
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'bind References

dwgProcessor.BindReferences Vault, ObjVer, "A Drawing Name", ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:0390 - Bind References

01/01/2019 09:00:00:0480 - DWG File Count: 1

01/01/2019 09:00:00:0490 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:3300 - Call BindReferences COM method.

01/01/2019 09:00:00:3670 - Processing Object: ID 1 Version 10

01/01/2019 09:00:00:3695 - DrawingName: A Drawing Name

01/01/2019 09:00:00:3850 - FileVer: ID 1 Version 4

01/01/2019 09:00:00:3850 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\iucnhedn.dwg

01/01/2019 09:00:00:4110 - Open DWG file

01/01/2019 09:00:00:4770 - Repath and Bind References

01/01/2019 09:00:00:6920 - Upload updated DWG file

01/01/2019 09:00:00:7240 - Delete temp files from server

01/01/2019 09:00:00:7250 - Releasing COM object.


CreatePDFRendition(Vault, DrawingObjVer, LogIdentifier)

CreatePDFRendition Method

Description

Creates a PDF rendition of the DWG file contained within the specified object. The method assumes that only one DWG file and PDF file exists within a Multi File Document (MFD) object. For Multi File Document (MFD) objects containing more than one DWG file, only the first file in the collection is processed. The generated PDF rendition is of the active Layout/Model when the drawing was last saved. Please see Known Issues and Limitations for more details.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG files exists in the specified object, then an error is raised.

Syntax

Sub CreatePDFRendition(Vault As Vault, DrawingObjVer As ObjVer, LogIdentifier As Object)

Parameters

Name

Data Type

Description

Vault

Vault

The Vault object provided by the event handler.

DrawingObjVer

ObjVer

ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").

The ObjVer is also the target for the generated PDF file. Single File Document (SFD) objects will automatically be converted to Multi File Document (MFD) objects.

LogIdentifier

String or TypedValue

Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'create PDF Rendition

dwgProcessor.CreatePDFRendition Vault, ObjVer, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:3701 - Create PDF Rendition

01/01/2019 09:00:00:3761 - DWG File Count: 1

01/01/2019 09:00:00:3771 - Creating ODA COM Object. (dllhost.exe)

01/01/2019 09:00:00:4371 - Call CreatePDFRendition COM method.

01/01/2019 09:00:01:1101 - Processing Object: ID 1 Version 14

01/01/2019 09:00:01:1411 - FileVer: ID 1 Version 5

01/01/2019 09:00:01:1421 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\31dheqpl.dwg

01/01/2019 09:00:01:1871 - Open DWG file

01/01/2019 09:00:01:5512 - Repath References

01/01/2019 09:00:01:8082 - Plot Settings

----------------------------------------------------------------------------------------------------------------------------------

Plot Layout: A1

Plot Type: Layout

Plot Centered: False

Paper Rotation: _90degrees

Paper Origin: 0.00, 0.00

Paper Size: 594.06, 841.04

Paper Units: Millimeters

Paper Margins: (Top): 3.17 (Left): 3.17 (Right): 3.17 (Bottom): 3.17

----------------------------------------------------------------------------------------------------------------------------------

01/01/2019 09:00:01:8152 - Exporting PDF

01/01/2019 09:00:02:0032 - Delete temp files from server

01/01/2019 09:00:02:0182 - Convert Object to MFD.

01/01/2019 09:00:02:0532 - Upload generated PDF file

01/01/2019 09:00:02:0532 - Delete temp PDF file from server

01/01/2019 09:00:02:0578 - Releasing COM object.


CreatePDFRendition(Vault, DrawingObjVer, LayoutName, TargetObjVer, LogIdentifier)

CreatePDFRendition Method

Description

Creates a PDF rendition of the DWG file contained within the specified object. The method assumes that only one DWG file exists within a Multi File Document (MFD) object. For Multi File Document (MFD) objects containing more than one DWG file, only the first file in the collection is processed. The generated PDF rendition is of the specified Layout.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG files exists in the specified object, then an error is raised.

Syntax

Sub CreatePDFRendition(Vault As Vault, DrawingObject As ObjVer, LayoutName As String, TargetObject As ObjVer, LogIdentifier As Object)

Parameters

Name

Data Type

Description

Vault

Vault

The Vault object provided by the event handler.

DrawingObjVer

ObjVer

ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").

LayoutName

String

Name of the Layout to render to PDF e.g. Model, Layout1

Or one of the keywords below:

<ActiveLayout> - Renders to PDF the active Layout/Model when the drawing was last saved.

<FirstLayout> - Renders to PDF the first Layout tab (excluding Model).

TargetObjVer

ObjVer

ObjVer of the target object to receive the rendered PDF file. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").

The target ObjVer can be the same as the DrawingObjVer or a separate object. If the target object is a Single File Document (SFD) then the rendered PDF will replace the original content. Otherwise the rendered PDF will be added to the Multi File Document (MFD) object.

LogIdentifier

String or TypedValue

Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'create PDF Rendition

dwgProcessor.CreatePDFRendition Vault, ObjVer, "<ActiveLayout>", ObjVer, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:3701 - Create PDF Rendition

01/01/2019 09:00:00:3761 - DWG File Count: 1

01/01/2019 09:00:00:3771 - Creating ODA COM Object. (dllhost.exe)

01/01/2019 09:00:00:4371 - Call CreatePDFRendition COM method.

01/01/2019 09:00:01:1101 - Processing Object: ID 1 Version 14

01/01/2019 09:00:01:1411 - FileVer: ID 1 Version 5

01/01/2019 09:00:01:1421 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\31dheqpl.dwg

01/01/2019 09:00:01:1871 - Open DWG file

01/01/2019 09:00:01:5512 - Repath References

01/01/2019 09:00:01:8082 - Plot Settings

----------------------------------------------------------------------------------------------------------------------------------

Plot Layout: A1

Plot Type: Layout

Plot Centered: False

Paper Rotation: _90degrees

Paper Origin: 0.00, 0.00

Paper Size: 594.06, 841.04

Paper Units: Millimeters

Paper Margins: (Top): 3.17 (Left): 3.17 (Right): 3.17 (Bottom): 3.17

----------------------------------------------------------------------------------------------------------------------------------

01/01/2019 09:00:01:8152 - Exporting PDF

01/01/2019 09:00:02:0032 - Delete temp files from server

01/01/2019 09:00:02:0532 - Upload generated PDF file

01/01/2019 09:00:02:0532 - Delete temp PDF file from server

01/01/2019 09:00:02:0578 - Releasing COM object.


CreatePDFRendition(Vault, DrawingObjVer, DrawingName, LayoutName, TargetObjVer, PDFName, UpdateSingleFileDocumentTitle, LogIdentifier)

CreatePDFRendition Method

Description

Creates a PDF rendition of the named DWG file contained within the specified object. The generated PDF rendition is of the specified Layout.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG file with the specified Drawing Name exists, then an error is raised.

Syntax

Sub CreatePDFRendition(Vault As Vault, DrawingObject As ObjVer, DrawingName As String, LayoutName As String, TargetObject As ObjVer, PDFName As String, UpdateSingleFileDocumentTitle As Boolean, LogIdentifier As Object)

Parameters

Name

Data Type

Description

Vault

Vault

The Vault object provided by the event handler.

DrawingObjVer

ObjVer

ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").

DrawingName

String

The name of the DWG file to process (excluding the file extension). Use with Multi File Document (MFD) objects containing more than one DWG file.

LayoutName

String

Name of the Layout to render to PDF e.g. Model, Layout1

Or one of the keywords below:

<ActiveLayout> - Renders to PDF the active Layout/Model when the drawing was last saved.

<FirstLayout> - Renders to PDF the first Layout tab (excluding Model).

TargetObjVer

ObjVer

ObjVer of the target object to receive the rendered PDF file. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").

The target ObjVer can be the same as the DrawingObjVer or a separate object. If the target object is a Single File Document (SFD) then the rendered PDF will replace the original content. Otherwise the rendered PDF will be added to the Multi File Document (MFD) object.

PDFName

String

Name of the generated PDF as shown in Multi File Document (MFD) objects. Or the object title when UpdateSingleFileDocumentTitle is set to True for Single File Document (SFD) objects.

UpdateSingleFileDocumentTitle

Boolean

If this parameter is True, the Single File Document (SFD) object name should be renamed to match the specified PDFName.

LogIdentifier

String or TypedValue

Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'create PDF Rendition

dwgProcessor.CreatePDFRendition Vault, ObjVer, "A Drawing Name", "<ActiveLayout>", ObjVer, "A PDF Name", False, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:3701 - Create PDF Rendition

01/01/2019 09:00:00:3761 - DWG File Count: 1

01/01/2019 09:00:00:3771 - Creating ODA COM Object. (dllhost.exe)

01/01/2019 09:00:00:4371 - Call CreatePDFRendition COM method.

01/01/2019 09:00:01:1101 - Processing Object: ID 1 Version 14

01/01/2019 09:00:01:1256 - DrawingName: A Drawing Name

01/01/2019 09:00:01:1411 - FileVer: ID 1 Version 5

01/01/2019 09:00:01:1421 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\31dheqpl.dwg

01/01/2019 09:00:01:1871 - Open DWG file

01/01/2019 09:00:01:5512 - Repath References

01/01/2019 09:00:01:8082 - Plot Settings

----------------------------------------------------------------------------------------------------------------------------------

Plot Layout: A1

Plot Type: Layout

Plot Centered: False

Paper Rotation: _90degrees

Paper Origin: 0.00, 0.00

Paper Size: 594.06, 841.04

Paper Units: Millimeters

Paper Margins: (Top): 3.17 (Left): 3.17 (Right): 3.17 (Bottom): 3.17

----------------------------------------------------------------------------------------------------------------------------------

01/01/2019 09:00:01:8152 - Exporting PDF

01/01/2019 09:00:02:0032 - Delete temp files from server

01/01/2019 09:00:02:0182 - Replacing SFD file with PDF file

01/01/2019 09:00:02:0532 - Delete temp PDF file from server

01/01/2019 09:00:02:0578 - Releasing COM object.


GetDWGInfo(Vault, DrawingObjVer, LogIdentifier) As DrawingInfo

GetDWGInfo Method

Description

Gets basic information about the DWG file in the specified object. The basic information includes the file format, current layout, all layout names and reference information. Reference information does not include nested references. The data is returned as a DrawingInfo object which contains properties providing access to the information.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

An error is raised if:

    • their is no valid DWG Processor license
    • the object does not contain a DWG file
    • the method fails for another reason

Consult the generated log file for detailed error information.

Syntax

Function GetDWGInfo(Vault As Vault, DrawingObjVer As ObjVer, LogIdentifier As Object) As DrawingInfo

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

Returns a DrawingInfo object or throws an exception.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'ignore errors
On Error Resume Next

'try to get drawing information
Dim dwgInfo : Set dwgInfo = dwgProcessor.GetDWGInfo(Vault, ObjVer, ActivityID)

'reinstate errors
On Error Goto 0

'on failure dwgInfo will be empty
If Not IsEmpty(dwgInfo) Then

'write file format and current layout to log file
dwgProcessor.WriteLog ActivityID, "File Format: " + dwgInfo.DWGFileFormat
dwgProcessor.WriteLog ActivityID, "Current Layout: " + dwgInfo.CurrentLayout

'write all layout names to log file
For Each Layout In dwgInfo.Layouts

dwgProcessor.WriteLog ActivityID, "Layout: " + Layout

Next

'write the boolean HasXrefs flag to log file
dwgProcessor.WriteLog ActivityID, "Has Xrefs: " + CStr(dwgInfo.HasXrefs)

'write all references to log file
Dim xref
For Each xref In dwgInfo.References
dwgProcessor.WriteLog ActivityID, "Reference Name : " + xref.Name + ", Path: " + xref.Path + ", Type: " + xref.Type
Next
Else
'write to log
dwgProcessor.WriteLog ActivityID, "An Error has occurred."
End If

The resulting log file would contain the following information:

01/01/2019 09:00:00:3477 - Get Drawing Information

01/01/2019 09:00:00:3607 - DWG File Count: 1

01/01/2019 09:00:00:3637 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:8807 - Call GetDrawingInformation COM method.

01/01/2019 09:00:00:9012 - Processing Object: ID 495 Version 33

01/01/2019 09:00:00:9267 - FileVer: ID 2 Version 2

01/01/2019 09:00:00:9307 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\4rqb1hvd.dwg

01/01/2019 09:00:00:9547 - Open DWG file

01/01/2019 09:00:01:0587 - Create DrawingInfo object

01/01/2019 09:00:01:0597 - Populate file format

01/01/2019 09:00:01:0607 - Populate current layout: A1

01/01/2019 09:00:01:0617 - Populate Layout array

01/01/2019 09:00:01:0807 - Populate DWG References

01/01/2019 09:00:01:0867 - Populate Image References

01/01/2019 09:00:01:0907 - Populate PDF References

01/01/2019 09:00:01:0997 - Delete temp files from server

01/01/2019 09:00:01:2747 - Deserialize drawing information from JSON.

01/01/2019 09:00:01:2987 - Releasing COM object.

01/01/2019 09:00:01:3007 - File Format: AC1032

01/01/2019 09:00:01:3017 - Current Layout: A1

01/01/2019 09:00:01:3037 - Layout: A1

01/01/2019 09:00:01:3037 - Layout: Model

01/01/2019 09:00:01:3047 - Has Xrefs: False


GetDWGInfo(Vault, DrawingObjVer, DrawingName, LogIdentifier) As DrawingInfo

GetDWGInfo Method

Description

Gets basic information about the named DWG file in the specified object. The basic information includes the file format, current layout, all layout names and reference information. Reference information does not include nested references. The data is returned as a DrawingInfo object which contains properties providing access to the information.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

An error is raised if:

    • their is no valid DWG Processor license
    • the object does not contain a DWG file
    • the method fails for another reason

Consult the generated log file for detailed error information.

Syntax

Function GetDWGInfo(Vault As Vault, DrawingObjVer As ObjVer, DrawingName As String, LogIdentifier As Object) As DrawingInfo

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
DrawingName | String | The name of the DWG file to process (excluding the file extension). Use with Multi File Document (MFD) objects containing more than one DWG file.
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

Returns a DrawingInfo object or throws an exception.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'ignore errors
On Error Resume Next

'try to get drawing information
Dim dwgInfo : Set dwgInfo = dwgProcessor.GetDWGInfo(Vault, ObjVer, "A Drawing Name", ActivityID)

'reinstate errors
On Error Goto 0

'on failure dwgInfo will be empty
If Not IsEmpty(dwgInfo) Then

'write file format and current layout to log file
dwgProcessor.WriteLog ActivityID, "File Format: " + dwgInfo.DWGFileFormat
dwgProcessor.WriteLog ActivityID, "Current Layout: " + dwgInfo.CurrentLayout

'write all layout names to log file
For Each Layout In dwgInfo.Layouts

dwgProcessor.WriteLog ActivityID, "Layout: " + Layout

Next

'write the boolean HasXrefs flag to log file
dwgProcessor.WriteLog ActivityID, "Has Xrefs: " + CStr(dwgInfo.HasXrefs)

'write all references to log file
Dim xref
For Each xref In dwgInfo.References
dwgProcessor.WriteLog ActivityID, "Reference Name : " + xref.Name + ", Path: " + xref.Path + ", Type: " + xref.Type
Next
Else
'write to log
dwgProcessor.WriteLog ActivityID, "An Error has occurred."
End If

The resulting log file would contain the following information:

01/01/2019 09:00:00:3477 - Get Drawing Information

01/01/2019 09:00:00:3607 - DWG File Count: 1

01/01/2019 09:00:00:3637 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:8807 - Call GetDrawingInformation COM method.

01/01/2019 09:00:00:9012 - Processing Object: ID 495 Version 33

01/01/2019 09:00:00:9176 - DrawingName: A Drawing Name

01/01/2019 09:00:00:9267 - FileVer: ID 2 Version 2

01/01/2019 09:00:00:9307 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\4rqb1hvd.dwg

01/01/2019 09:00:00:9547 - Open DWG file

01/01/2019 09:00:01:0587 - Create DrawingInfo object

01/01/2019 09:00:01:0597 - Populate file format

01/01/2019 09:00:01:0607 - Populate current layout: A1

01/01/2019 09:00:01:0617 - Populate Layout array

01/01/2019 09:00:01:0807 - Populate DWG References

01/01/2019 09:00:01:0867 - Populate Image References

01/01/2019 09:00:01:0907 - Populate PDF References

01/01/2019 09:00:01:0997 - Delete temp files from server

01/01/2019 09:00:01:2747 - Deserialize drawing information from JSON.

01/01/2019 09:00:01:2987 - Releasing COM object.

01/01/2019 09:00:01:3007 - File Format: AC1032

01/01/2019 09:00:01:3017 - Current Layout: A1

01/01/2019 09:00:01:3037 - Layout: A1

01/01/2019 09:00:01:3037 - Layout: Model

01/01/2019 09:00:01:3047 - Has Xrefs: False


LogPDFSettings(LogIdentifier)

LogPDFSettings Method

Description

Writes the DWG Processor PDF Settings for the current vault to a log file.

Please see Log Files for more information.

Syntax

Sub LogPDFSettings(LogIdentifier As Object)

Parameters

Name | Data Type | Description
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'write PDF Setting to log

dwgProcessor.LogPDFSettings ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:0085 - DWG PDF Rendition Settings

----------------------------------------------------------------------------------------------------------------------------------

PDF File Settings

----------------------------------------------------------------------------------------------------------------------------------

PDF Version: v1.5

Enable Layer Support: True

Include Off Layers: False

Linearise PDF: False

Enable Compression: True

ASCII-HEX Encoded: False

Export Hyperlinks: False

Enable Measuring Scale: False

PDF Background Colour: Color [A=255, R=255, G=255, B=255]

Colour Policy: No Policy

----------------------------------------------------------------------------------------------------------------------------------

Vectorisation and Rendering

----------------------------------------------------------------------------------------------------------------------------------

Zoom to Extents Mode: False

Enable Simple Geometry Optimisation: True

Use Hidden Line Removal Algorithm: False

Enable Transparency: False

Merge Crossing Line Colours: False

----------------------------------------------------------------------------------------------------------------------------------

Font and Test Settings

----------------------------------------------------------------------------------------------------------------------------------

Embedded True Type Fonts: False

Embedded True Type Font Optimisation: False

True Type Fonts As Geometry: False

SHX Fonts As Geometry: False

Searchable Text: No Search

----------------------------------------------------------------------------------------------------------------------------------

Hatch Settings

----------------------------------------------------------------------------------------------------------------------------------

Hatch Export Resolution (DPI): 72

Export Solid Hatches using: Bitmap

Export Gradient Hatches using: Bitmap

Export Other Hatches using: Bitmap

----------------------------------------------------------------------------------------------------------------------------------

Image Settings

----------------------------------------------------------------------------------------------------------------------------------

Image Cropping: True

DCT Compression: False

DCT Compression Quality: 50

Colour Resolution (DPI): 400

Monochrome Resolution (DPI): 400

----------------------------------------------------------------------------------------------------------------------------------

Property Mappings

----------------------------------------------------------------------------------------------------------------------------------

PDF Property Name M-Files Property Name

----------------------------------------------------------------------------------------------------------------------------------

Title Name or title

Author Created by

Subject <Not Mapped>

Keywords <Not Mapped>

Creator <Not Mapped>

----------------------------------------------------------------------------------------------------------------------------------

Support Paths

----------------------------------------------------------------------------------------------------------------------------------

C:\Windows\Fonts

C:\Autodesk\Fonts

C:\Autodesk\Support

C:\Autodesk\Plotters\Plot Styles

----------------------------------------------------------------------------------------------------------------------------------


LogPropertyMappings(LogIdentifier)

LogPropertyMappings Method

Description

Writes the DWG Processor Property Mapping Settings for the current vault to a log file.

Please see Log Files for more information.

Syntax

Sub LogPropertyMappings(LogIdentifier As Object)

Parameters

Name | Data Type | Description
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'write PDF Setting to log

dwgProcessor.LogPropertyMappings ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:3318 - DWG Property Mappings

----------------------------------------------------------------------------------------------------------------------------------

Title Block Name : EXC A0; EXC A1; EXC A2; EXC A3

----------------------------------------------------------------------------------------------------------------------------------

Mappings

----------------------------------------------------------------------------------------------------------------------------------

Attribute Name M-Files Property Name Property Type Sync Direction

----------------------------------------------------------------------------------------------------------------------------------

DRAWINGNO Name or title Direct Sync to File Only

TITLE1 Title 1 Direct Bi-Directional

TITLE2 Title 2 Direct Bi-Directional

TITLE3 Title 3 Direct Bi-Directional

DRAWNBY Created by Direct Sync to File Only

----------------------------------------------------------------------------------------------------------------------------------


RepathReferences(Vault, DrawingObjVer, ForceRepath, LogIdentifier)

RepathReferences Method

Description

Attempts to correct external reference paths when the specified object has changed from a Single File Document (SFD) to a Multi File Document (MFD) or vice versa. When Xrefs are attached using relative paths, the change from SFD to MFD or MDF to SFD changes the location of the parent drawing resulting in the relative reference paths being broken. This method will attempt to fix the broken links if the SFD/MFD state has changed between versions. The repathing can be forced by setting the ForceRepath parameter to True. The DWG file is saved back as the same file version as the original file.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG files exists in the specified object, then an error is raised.

Syntax

Sub RepathReferences(Vault As Vault, DrawingObjVer As ObjVer, ForceRepath As Boolean, LogIdentifier As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
ForceRepath | Boolean | If False, the repathing only occurs if the SFD/MFD state has changed. The repathing can be forced by setting this parameter to True.
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'bind References

dwgProcessor.RepathReferences Vault, ObjVer, True, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:1014 - Repath References

01/01/2019 09:00:00:1094 - DWG File Count: 1

01/01/2019 09:00:00:1114 - Forcing Reference Repath.

01/01/2019 09:00:00:1114 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:3545 - Call RepathReferences COM method.

01/01/2019 09:00:00:3895 - Processing Object: ID 1 Version 12

01/01/2019 09:00:00:4145 - Filename: Example Drawing (ID 1).dwg

01/01/2019 09:00:00:4165 - Virtual Path: \\ID2\1f1d833b-6c4c-46d8-a558-7c5c6d9b6df9\0\0-999\1\S\v12\Example Drawing (ID 1).dwg

01/01/2019 09:00:00:4165 - FileVer: ID 1 Version 5

01/01/2019 09:00:00:4175 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\hck2quex.dwg

01/01/2019 09:00:00:4525 - Open DWG file

01/01/2019 09:00:00:5395 - Repath DWG References

01/01/2019 09:00:00:5455 - Repath Image References

01/01/2019 09:00:00:5475 - Repath PDF References

01/01/2019 09:00:00:7365 - Nothing to Repath, file not updated.

01/01/2019 09:00:00:7365 - Delete temp files from server

01/01/2019 09:00:00:7375 - Releasing COM object.


RepathReferences(Vault, DrawingObjVer, DrawingName, ForceRepath, LogIdentifier)

RepathReferences Method

Description

Attempts to correct external reference paths when the specified object has changed from a Single File Document (SFD) to a Multi File Document (MFD) or vice versa. When Xrefs are attached using relative paths, the change from SFD to MFD or MDF to SFD changes the location of the parent drawing resulting in the relative reference paths being broken. This method will attempt to fix the broken links if the SFD/MFD state has changed between versions. The repathing can be forced by setting the ForceRepath parameter to True. The DWG file is saved back as the same file version as the original file.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG file with the specified Drawing Name exists, then an error is raised.

Syntax

Sub RepathReferences(Vault As Vault, DrawingObjVer As ObjVer, DrawingName As String, ForceRepath As Boolean, LogIdentifier As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
DrawingName | String | The name of the DWG file to process (excluding the file extension). Use with Multi File Document (MFD) objects containing more than one DWG file.
ForceRepath | Boolean | If False, the repathing only occurs if the SFD/MFD state has changed. The repathing can be forced by setting this parameter to True.
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'bind References

dwgProcessor.RepathReferences Vault, ObjVer, "A Drawing Name", True, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:1014 - Repath References

01/01/2019 09:00:00:1094 - DWG File Count: 1

01/01/2019 09:00:00:1114 - Forcing Reference Repath.

01/01/2019 09:00:00:1114 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:3545 - Call RepathReferences COM method.

01/01/2019 09:00:00:3895 - Processing Object: ID 1 Version 12

01/01/2019 09:00:00:3951 - DrawingName: A Drawing Name

01/01/2019 09:00:00:4145 - Filename: A Drawing Name (ID 1).dwg

01/01/2019 09:00:00:4165 - Virtual Path: \\ID2\1f1d833b-6c4c-46d8-a558-7c5c6d9b6df9\0\0-999\1\S\v12\Example Drawing (ID 1).dwg

01/01/2019 09:00:00:4165 - FileVer: ID 1 Version 5

01/01/2019 09:00:00:4175 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\hck2quex.dwg

01/01/2019 09:00:00:4525 - Open DWG file

01/01/2019 09:00:00:5395 - Repath DWG References

01/01/2019 09:00:00:5455 - Repath Image References

01/01/2019 09:00:00:5475 - Repath PDF References

01/01/2019 09:00:00:7365 - Nothing to Repath, file not updated.

01/01/2019 09:00:00:7365 - Delete temp files from server

01/01/2019 09:00:00:7375 - Releasing COM object.


SetModifiedBy(Vault, ObjVer, UserID)

SetModifedBy Method

Description

When modifying objects in an event handler, the object is shown as modified by (M-Files Server).

Use this the method to set the modifying user to the specified User ID.

WARNING: The specified object must be in a Checked Out state

Syntax

Sub SetModifiedBy(Vault As Vault, ObjVer As ObjVer, UserID As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
ObjVer | ObjVer | ObjVer of object to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
UserID | Integer or TypedValue | The ID of the desired modifying user.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'set modifying user

dwgProcessor.SetModifiedBy Vault, ObjVer, CurrentUserID


SyncPropertiesFromMFiles(Vault, DrawingObjVer, LogIdentifier)

SyncPropertiesFromMFiles Method

Description

Updates the titleblock(s) of the DWG file in the specified object. The block names and attribute mappings are determined by the Property Mapping configuration of the vault. If the DWG file contains more than one instance of the configured block names, all matching blocks are updated. The DWG file is saved back as the same file version as the original file.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG files exists in the specified object, then an error is raised.

Syntax

Sub SyncPropertiesFromMFiles(Vault As Vault, DrawingObjVer As ObjVer, LogIdentifier As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'sync properties from M-Files

dwgProcessor.SyncPropertiesFromMFiles Vault, ObjVer, ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:0053 - Sync Properties from M-Files

01/01/2019 09:00:00:0123 - DWG File Count: 1

01/01/2019 09:00:00:0133 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:2813 - Call SyncPropertiesFromMFiles COM method.

01/01/2019 09:00:00:3633 - Processing Object: ID 1 Version 8

01/01/2019 09:00:00:3783 - FileVer: ID 1 Version 3

01/01/2019 09:00:00:3783 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\01cnyvti.dwg

01/01/2019 09:00:00:4263 - Open DWG file

01/01/2019 09:00:00:4993 - Update attribute values of matching Titleblocks

01/01/2019 09:00:00:5763 - Save DWG file

01/01/2019 09:00:00:7303 - Upload updated DWG file

01/01/2019 09:00:00:7653 - Delete temp files from server

01/01/2019 09:00:00:7673 - Releasing COM object.


SyncPropertiesFromMFiles(Vault, DrawingObjVer, DrawingName, LogIdentifier)

SyncPropertiesFromMFiles Method

Description

Updates the titleblock(s) of the named DWG file in the specified object. The block names and attribute mappings are determined by the Property Mapping configuration of the vault. If the DWG file contains more than one instance of the configured block names, all matching blocks are updated. The DWG file is saved back as the same file version as the original file.

A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.

WARNING: The specified object must be in a Checked Out state

If no DWG file with the specified Drawing Name exists, then an error is raised.

Syntax

Sub SyncPropertiesFromMFiles(Vault As Vault, DrawingObjVer As ObjVer, DrawingName As String, LogIdentifier As Object)

Parameters

Name | Data Type | Description
Vault | Vault | The Vault object provided by the event handler.
DrawingObjVer | ObjVer | ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer").
DrawingName | String | The name of the DWG file to process (excluding the file extension). Use with Multi File Document (MFD) objects containing more than one DWG file.
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'sync properties from M-Files

dwgProcessor.SyncPropertiesFromMFiles Vault, ObjVer, "A Drawing Name", ActivityID

The resulting log file would contain the following information:

01/01/2019 09:00:00:0053 - Sync Properties from M-Files

01/01/2019 09:00:00:0123 - DWG File Count: 1

01/01/2019 09:00:00:0133 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:00:2813 - Call SyncPropertiesFromMFiles COM method.

01/01/2019 09:00:00:3633 - Processing Object: ID 1 Version 8

01/01/2019 09:00:00:3702 - DrawingName: A Drawing Name

01/01/2019 09:00:00:3783 - FileVer: ID 1 Version 3

01/01/2019 09:00:00:3783 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\01cnyvti.dwg

01/01/2019 09:00:00:4263 - Open DWG file

01/01/2019 09:00:00:4993 - Update attribute values of matching Titleblocks

01/01/2019 09:00:00:5763 - Save DWG file

01/01/2019 09:00:00:7303 - Upload updated DWG file

01/01/2019 09:00:00:7653 - Delete temp files from server

01/01/2019 09:00:00:7673 - Releasing COM object.


WriteLog(LogIdentifier, Message)

WriteLog Method

Description

Writes a custom message to a log file.

Please see Log Files for more information.

Syntax

Sub WriteLog(LogIdentifier As Object, Message As Object)

Parameters

Name | Data Type | Description
LogIdentifier | String or TypedValue | Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID.
Message | Object | A String or Object to write to the log file. If an object is specified, it must be convertible to String.

Return

No return value.

Example

'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")

'write to log

dwgProcessor.WriteLog ActivityID, "Message 1"

dwgProcessor.WriteLog ActivityID, "Message 2"

dwgProcessor.WriteLog ActivityID, "Message 3"

The resulting log file would contain the following information:

01/01/2019 09:00:00:8802 - Message 1

01/01/2019 09:00:00:8922 - Message 2

01/01/2019 09:00:00:8932 - Message 3


DrawingInfo

DrawingInfo Object

Description

The DrawingInfo object is returned from the GetDWGInfo method and contains basic information about a DWG file.

Properties

Name | Data Type | Description
DWGFileFormat | String | Contains the DWG file format code. e.g. AC1012 - DWG Release 13 AC1014 - DWG Release 14 AC1015 - DWG Release 2000 AC1018 - DWG Release 2004 AC1021 - DWG Release 2007 AC1024 - DWG Release 2010 AC1027 - DWG Release 2013 AC1032 - DWG Release 2018
CurrentLayout | String | The name of the current\active layout of the DWG file.
Layouts | String() Array of Strings | An array of all the layout names in the DWG file.
HasXref | Boolean | A boolean flag indicating whether the DWG file has one or more external references. External references include DWG files, Image files and PDF attachments.
References | XrefInfo() Array of XrefInfo objects | An array of XrefInfo objects giving details of the DWG external reference files.


XrefInfo

Types ››

XrefInfo Object

Description

The XrefInfo object contains basic information about an external reference.

Properties

Name | Data Type | Description
Name | String | Name of the reference.
Path | String | The full path of the reference as stored in the DWG file.
Resolved | Boolean | A boolean flag indicating whether the reference is resolved. Only valid for full path references stored outside of M-Files.
Type | String | A string defining the type of the reference e.g. DWG, Image or PDF


Log Files

The DWG Processor has the ability to generate log files during its operation. By supplying the LogIdentifer parameter to the various script functions, a log file is automatically created or appended to. The LogIdentifier determines the filename of the resulting log file. Typically these would by based on the current activity or transaction, thereby creating separate log files for each event.

The log files are useful when trying to determine why a particular DWG Processor function might have failed. The WriteLog function provides the ability to include custom log entries to help debug script related issues.

The log files are created on the M-Files server in the following location:

C:\ProgramData\PentagonDOCS\Server Logs\<Vault Name> <Vault GUID>

Each vault with the DWG Processor installed will have its own Server Logs sub folder based on the display name of the vault and its globally unique identifier (GUID).

Example Log File

Filename: {8056887D-1C6E-413C-994C-48AAB14219A3}.log

01/01/2019 09:00:00:5562 - Vault Extension Method: ExDOCS_WriteAttributes_DWG

01/01/2019 09:00:00:5862 - Checking Out...

01/01/2019 09:00:00:6482 - DWG File Count: 1

01/01/2019 09:00:00:6492 - Creating RealDWG COM Object. (dllhost.exe)

01/01/2019 09:00:01:2083 - Call SyncPropertiesFromMFiles COM method.

01/01/2019 09:00:01:3183 - Processing Object: ID 1 Version 2

01/01/2019 09:00:01:3353 - FileVer: ID 1 Version 2

01/01/2019 09:00:01:3353 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\4yx2uhha.dwg

01/01/2019 09:00:01:3973 - Download failed: The file has not been committed yet.

01/01/2019 09:00:01:3973 - Attempting to Download previous File Version

01/01/2019 09:00:01:4093 - FileVer: ID 1 Version 1

01/01/2019 09:00:01:4093 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\4yx2uhha.dwg

01/01/2019 09:00:01:4453 - Open DWG file

01/01/2019 09:00:01:5483 - Update attribute values of matching Titleblocks

01/01/2019 09:00:01:6333 - Save DWG file

01/01/2019 09:00:02:1063 - Upload updated DWG file

01/01/2019 09:00:02:1443 - Delete temp files from server

01/01/2019 09:00:02:1453 - Releasing COM object.

01/01/2019 09:00:02:1453 - Set Modifying User

01/01/2019 09:00:02:1783 - Checking In...

Automatic Removal of Log Files

Because the creation of log files can be based on an activity or transaction, the number of log files can quickly accumulate. The DWG Processor will automatically remove log files older than 24 hours.

This setting can be increased or decreased by changing the following registry entry:

Registry Key | HKEY_LOCAL_MACHINE\SOFTWARE\ExcitechDOCS\Server
Value Name | DeleteLogFilesAfterHours
Type | REG_DWORD
Default | 0x00000018 (24) 24 Hours

NOTE: Changing of this value does not require the vault to be restarted.


Errors

During the initial operation of the DWG Processor Application you may receive one or more of the errors described below. This page will give some reasons for those errors and how to resolve them.

No DWG Processor License Error

This error occurs when the DWG Processor Application does not have a valid license installed. This can happen for the following reasons:

  • A license was not installed
  • A time limited license has expired
  • A trial license has expired
  • The license is no longer valid (e.g. the M-Files serial number has changed)

A license must be installed or reinstalled. See Licensing for more information.

The specified module could not be found

This error occurs when the Visual C++ Redistributable for Visual Studio 2015 (x64) has not been installed.

See Prerequisites for more information.

RPC Error

This error occurs when the DCOM security settings have not been changed as described in this help file. If they are correct, then the M-Files Server service might need restarting.

Please see DCOM Settings for more information.

Also See

Licensing
Prerequisites
DCOM Settings


Support

DWG Processor Application for M-Files

For support related to the installation and or usage of this Application, please contact:

Pentagon Solutions
Suite 3
Teal Pavilion
Portside Business Park
189 Airport Road West
Belfast, Northern Ireland
BT3 9ED

Pentagon Support

T: 02890455355
E: info@pentagonsolutions.com
www.pentagonsolutions.com